const express = require("express")
const Staff = require("../models/staff")
const router = express.Router()
// 某个员工业绩
router.get("/performance",async(req,res)=>{{
    const result=await Staff.aggregate([{
        $lookup:{
            from: 'expenses',
            localField: 'employee_id',
            foreignField: 'employee_id',
            as: 'expense_list'
        }
    },{
        $match:{
            employee_id: req.query.employee_id
        }
    }])
    res.send(result)
}})
// 某个员工工资  所有实收   * 0.4 

// 店内日营业额
router.get("/zongperformance",async(req,res)=>{{
    const result=await Staff.aggregate([{
        $lookup:{
            from: 'expenses',
            localField: 'employee_id',
            foreignField: 'employee_id',
            as: 'expense_list'
        }
    }])
    res.send(result)
}})
module.exports=router